package hapi.creator;

import jade.core.Agent;
import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.wrapper.AgentContainer;
import jade.wrapper.AgentController;
import jade.wrapper.ContainerController;
import jade.wrapper.StaleProxyException;

public class CreatorAgent extends Agent{

	@Override
	protected void takeDown() {
		System.out.println("fui");
	}

	@Override
	protected void setup() {
			
		for(int h=0; h<1; h++){
			Profile prof = new ProfileImpl();
			prof.setParameter(Profile.PLATFORM_ID, "Send"+h);
			prof.setParameter(Profile.CONTAINER_NAME, "Senders"+h);
			
			ContainerController control = Runtime.instance().createAgentContainer(prof);
			AgentController ac = null;
			
			for(int j=0; j<1; j++){
				try {
					ac = control.createNewAgent(h+"send"+j, "hapi.send.SendAgent",null);
					ac.start();
				} catch (StaleProxyException e) {
					e.printStackTrace();
				}
			}
		}
		
		doDelete();
	}

	
}
